//
//  KXComponentAppDelegate.m
//  JPVideoPlayerDemo
//
//  Created by xin on 2018/4/20.
//  Copyright © 2018年 NewPan. All rights reserved.
//

#import "KXComponentAppDelegate.h"
#import "KXNetworkStatusService.h"

@implementation KXComponentAppDelegate
{
    NSMutableArray *allServices;
}

+ (instancetype)instance
{
    static KXComponentAppDelegate *instance = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        instance = [[KXComponentAppDelegate alloc] init];
    });
    return instance;
}

- (NSMutableArray *)services
{
    if (!allServices) {
        allServices = [[NSMutableArray alloc]init];
        [self registerServices];
    }
    
    return allServices;
}

- (void)registerServices
{
    [self registerService:[[KXNetworkStatusService alloc] init]];
}

- (void)registerService:(id)service
{
    if (![allServices containsObject:service])
    {
        [allServices addObject:service];
    }
}

@end
